$(document).ajaxSend(function (e, xhr, opt) {
  // 与前端存放的key名称保持一致
  var user_token = localStorage.getItem("user_token");
  xhr.setRequestHeader("user_token_header", user_token);
});

function getUserInfo(url) {
  $.ajax({
    type: "post",
    url: url,
    success: function (result) {
      if (result.code == 200 && result.data != null) {
        // 填充主页信息
        $(".left .card .h3").text(result.data.userName);
        $(".left .card .a").attr("href", result.data.githubUrl);
      } else {
        console("信息获取失败")
      }
    }
  });
}

function logout() {
  localStorage.removeItem("user_token");
  location.href = ("blog_login.html");
}